package ar.com.ctrln.view.menu.mantenimiento;

import java.util.LinkedList;
import java.util.List;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Toolbar;
import org.zkoss.zul.Window;

public class MenuComposerMantenimiento extends GenericForwardComposer<Component> {

	
	private static final long serialVersionUID = 4361030587150372093L;
	Window wDashboard;
	Window wRegistrarTicket;
	Window wConsultarTicket;
	Window wConsultarFact;
	Window wRegistrarCompra;
	Window wConsultarCompra;
	Window wRegistrarPedido;
	Window wConsultarPedido;
	Window wRegistrarProveedor;
	Window wConsultarProveedor;
	
	Component registrarWindow = null;
	
	Toolbar toolbar;
	List<Component> heap = new LinkedList<Component>();
	
	
	@Override
	public void doAfterCompose(Component comp) throws Exception {
		super.doAfterCompose(comp);
		Component window = Executions.createComponents(
				"/zul/mantenimiento/dashboard.zul", wDashboard, null);
		heap.add(window);
		
	}
/**
 * Metodos de Eventos del Menú
 */
	
	public void onClick$bRegistrarTicket$wMenu$iMenu() {
		if (registrarWindow!=null) registrarWindow.detach();
		registrarWindow = Executions.createComponents("/zul/mantenimiento/tickets/registrarTicket.zul",null, null);
		heap.add(registrarWindow);
	}
	
	public void onClick$bConsultarTicket$wMenu$iMenu(){
		
		if(wConsultarTicket!=null){
			wConsultarTicket.detach();
		}		
		wConsultarTicket = (Window)Executions.createComponents("/zul/mantenimiento/tickets/consultarTicket.zul", wDashboard, null);
		heap.add(wConsultarTicket);
		
	}
	
public void onClick$bConsultarFactibilidad$wMenu$iMenu(){
		
	if(wConsultarFact!=null){
		wConsultarFact.detach();
	}	
	wConsultarFact = (Window)Executions.createComponents("/zul/mantenimiento/factibilidad/consultarFactibilidad.zul", wDashboard, null);
		heap.add(wConsultarFact);
	
	}
	
}